#include "visit.h"

Ret_visit_argCompUnit* visit_argCompUnit(ASTNode* node, SymbolTable* s, Module* m, BasicBlock* bb) {
    Ret_visit_argCompUnit* ret = new Ret_visit_argCompUnit();

    if (!node){
        variant<int, float, string> res;
        res = 0;

        ret -> init_val = res;
        return ret;
    }

    ASTNode* child = node->children[0];
    if(child->type == "Ident"){

        string ident = visit_Ident(child, s, bb);
        if(node->children.size() == 1){
            // argCompUnit -> Ident
        }
        else if(node->children.size() == 3){
            Ret_visit_funcOrVarDef* ret_funcorvardef = visit_funcOrVarDef(node->children[1], s, m, bb);
            if(ret_funcorvardef -> is_funcDef == false){
                ret -> ident = ident;
                ret -> init_val = ret_funcorvardef -> res;
                ret -> is_funcDef = false;
                return ret;
            }
            else{
                // 函数定义
                
                ret -> ident = ident;
                ret -> is_funcDef = true;
                

                return ret;
            }
        }

    }
    else if(child->type == "main"){

    }
}